package com.javasm.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private Integer code;
    private String msg;
    private Object data;
    private Integer all;
    private Double money;

    public static R ok(){
        return ok(null);
    }
    public static R ok(Object result){
        return new R(200,"success",result,null,null);
    }
    public static R okk(Object result, Integer a){
        return new R(200,"success",result,a,null);
    }

    public static R error(Exception e){
        return new R(500,e.getMessage(),null,null,null);
    }


    public static R ok(Object result,  double all) {
        return new R(200,"success",result,null,all);
    }
}
